#include "Bucket.h"

bool Bucket::write(Patient patient, string fname)
{
	fsteam filestr;
	
	filestr.exceptions(ifstream::failbit, ifstream::badbit);
	try 
	{
		filestr.open(fname, fstream::in);
		filestr << Patient;
	}
	catch(ifstream::failure exceptions)
	{
		cout << "Error opening/writing to file " << fname << endl;
		filestr.close();
		return false;
	}
	
	filestr.close();

	return true;
}


Patient Bucket::read(streampos pos, string fname)
{
	fstream filestr;
	char* buffer;
	
	filestr.exceptions(ifstream::failbit, ifstream::badbit);
	try 
	{
		filestr.seekg(0, pos);
		filestr.read()
		
	}
	catch (ifstream::failure exceptions) 
	{
		cout << "Error opening/reading file " << fname << endl;
		filestr.close();
		return ;
	}
	
	return NULL;
}